package info.webest.reminder;

import info.webest.app.wbApplication;
import info.webest.reminder.service.UpdateService;
import android.app.Activity;
import android.content.res.Configuration;

public class AppReminder extends wbApplication {

	protected static AppReminder instance = null;

	@Override
	public void onCreate() {
		super.onCreate();
		instance = this;
	}

	public static AppReminder getInstance() {
		if (instance == null) {
			instance = new AppReminder();
		}
		return instance;
	}

	public static void ApplyPrefs(Activity a) {
		/*
		 * if (Options.getCurrentTheme() == 1) { a.setTheme(R.style.ThemeBlack);
		 * Log.v("setTheme", "@@@ BlackTheme"); } else {
		 * a.setTheme(R.style.ThemeLight); Log.v("setTheme", "@@@ LightTheme");
		 * }
		 */
	}

	@Override
	public void onConfigurationChanged(Configuration newConfig) {

		//Toast.makeText(this, "App onConfigurationChanged", Toast.LENGTH_SHORT);
		
		switch (newConfig.orientation) {

		case Configuration.ORIENTATION_PORTRAIT:
			UpdateService.ItemCount = Options.getWidgetItemCountPortrait();
			break;

		case Configuration.ORIENTATION_LANDSCAPE:
			UpdateService.ItemCount = Options.getWidgetItemCountLandscape();
			break;
		}
		
		WidgetProvider.update(this);

		super.onConfigurationChanged(newConfig);

	}

}
